<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!-------------     HTML5.0 ------------------->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>SMART VE</title>
<link rel="stylesheet" href="resources/css/jquery.mobile-1.3.0.css" />
<link rel="stylesheet" href="resources/css/main.css" />
<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="resources/js/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript">
function joinMember(){
	var url = "member.do";
	var action = "insert";
	
	var id = $("#VE_MEMBER_ID").val();
	var username = $("#USERNAME").val();
	var pw = $("#PW").val();
	
	if(id==""){
		alert("id (E-mail) 를 입력해 주세요.");
		return;
	}else{
		if(!check_mailValue(id))
		{
			alert("메일 주소가 올바르지 않습니다.");
			return;
		}
		
	}
	if(username==""){
		alert("이름을 입력해 주세요.");
		return;
	}
	if(pw==""){
		alert("암호를 입력해 주세요.");
		return;
	}
	$.getJSON(url, "action="+action+"&VE_MEMBER_ID="+id+"&USERNAME="+username+"&PW="+pw, function(json) {
		
		if(json>0){
			alert('회원가입을 완료하였습니다. 인증메일을 확인해 주세요!');
		}else if(json < 0){
			alert('이미 가입된 메일 주소입니다.다시 회원가입을 해주세요!');
		}else{
			alert('회원 가입에 실패하였습니다. 다시 회원가입을 해주세요!');
		}
		location.href = "/redeye";
	});
}
</script>
</head>

<body class="main">
<div id="wrapper" data-role="page">
	<div id="header" data-role="header" data-position="fixed" data-tap-toggle="false">
<!-- 2013-05-14 back버튼 수정 -->
		<a href="/" class="btn_back">back</a>
		<h1>New Account</h1>
	</div>
	<div id="container" data-role="content" class="pnl_content">
		<div id="new_account" class="content">
			<ul class="field">
				<li><input type="email" id="VE_MEMBER_ID" name="VE_MEMBER_ID" placeholder="E-mail" data-role="none" class="textform" /></li>
				<li><input type="text" id="USERNAME" name="USERNAME" placeholder="Username" data-role="none" class="textform" /></li>
				<li><input type="password" id="PW" name="PW" placeholder="Password" data-role="none" class="textform" /></li>
			</ul>
			<a href="#" class="btn_green_wide" onclick="joinMember();">가입하기</a>
			<p>계정등록을 통해 본인은 SMART VE 의<br /><a href="agreement.html">이용약관 및 개인정보보호</a> 방침에 동의합니다</p>
		</div>
	</div>
</div>
</body>

<script type="text/javascript" src="resources/js/common.js"></script>

</html>